<?php

function createLog($msg, $stack = null) {
    if ($stack== null){
        insertSQLDebug($msg, getStackTrace());
    }else{
        insertSQLDebug($msg, $stack);
    }
    
}


function insertSQLDebug($query, $post = null, $sessions = null) {
    if ($post != null) {
        if ($sessions != null) {
            $query = sprintf(SQL::$INSERT_SQLDEBUG, mysql_real_escape_string($query), mysql_real_escape_string($post), mysql_real_escape_string($sessions));
        } else {
            $query = sprintf(SQL::$INSERT_SQLDEBUG, mysql_real_escape_string($query), mysql_real_escape_string($post), null);
        }
    } else {
        $query = sprintf(SQL::$INSERT_SQLDEBUG, mysql_real_escape_string($query), null, null);
    }
    mysql_query($query, getCon());
}

?>
